Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az_heat() improvements #64

Merged
merged 9 commits into from
Dec 27, 2023
Merged

az_heat() improvements #64

merged 9 commits into from
Dec 27, 2023

Conversation

Aariq
Copy link
Member

@Aariq Aariq commented Nov 2, 2023

This PR was originally a fix for #63, but I think that might have been mostly fixed by #62. Now contains additional tests for az_heat() and some improvements in messages and how missing data for stations is handled.

This PR also adds a useful debug option I should have implemented a long time ago. If you run options(azmet.print_api_call = TRUE) then you'll see the HTTP request printed for every az_*() function. This will be helpful for debugging. I'm not sure exactly where to document this (or even if it should be documented in a way that end users can see).

@Aariq Aariq linked an issue Dec 11, 2023 that may be closed by this pull request
Merge commit 'e6ca1aeb4b984ee1928019b8d3ad196f31c945b1'

#Conflicts:
#	tests/testthat/heat_default/hueto/default/default/default.json
#	tests/testthat/heat_end/hueto/az01/default/default.json
#	tests/testthat/heat_station/hueto/az09/default/default.json
#	tests/testthat/heat_station_vector/hueto/az01/default/default.json
#	tests/testthat/heat_station_vector/hueto/az02/default/default.json
#	tests/testthat/test-az_heat.R
@Aariq Aariq changed the title Heat endpoint date fix az_heat() improvements Dec 12, 2023
@Aariq Aariq marked this pull request as ready for review December 12, 2023 17:30
@Aariq
Copy link
Member Author

Aariq commented Dec 12, 2023

@jeremylweiss if you could confirm that az_heat() is behaving as it should with this PR, that would be great!

Copy link
Member

@jeremylweiss jeremylweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice progress. The confirmation of query and return dates through the messages is assuring, especially when requesting accumulations that start in the latter part of one calendar year and end in the early part of the next calendar year. As in dormancy/bud break models that look at either/both chill or/and heat accumulation.

I'm assuming that when date requests precede the earliest API availability date (currently "2023-01-01"), the new error message will appear once we merge that branch? Right now, az_heat(start_date = "1980-01-01") doesn't return No data is available before 2021-01-01. Please choose a later date.

Merge commit 'f48239ce0d1df8a1735005f1d6bb7faadc400038'

#Conflicts:
#	NEWS.md
@Aariq
Copy link
Member Author

Aariq commented Dec 14, 2023

I'm assuming that when date requests precede the earliest API availability date (currently "2023-01-01"), the new error message will appear once we merge that branch? Right now, az_heat(start_date = "1980-01-01") doesn't return No data is available before 2021-01-01. Please choose a later date.

I just merged main into this PR, so now it should work

library(devtools)
load_all()
az_heat(start_date = "1980-01-01")
# Error in parse_params(station_id, start = start_date, end = end_date) : 
#   No data is available before 2021-01-01. Please choose a later date.

@jeremylweiss
Copy link
Member

Yep, looks good from here, too! A nice confirmation that I was understanding the different branches and merges, phew! 🤣

@Aariq Aariq merged commit 91f0e20 into main Dec 27, 2023
7 checks passed
@Aariq Aariq deleted the heat-date branch December 27, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

az_heat only returns data to date - 2
2 participants